import request from "../utils/request";
// 获取轮播图的数据
const fetchBanner = (params={}) => {
  return request.get('/banner/list',{params})
}
// 获取分类列表信息
const fetchCate = (params={}) => {
  return request.get('/shop/goods/category/all',{params})
}
// 获取商品信息
const fetchItem = (params = {}) => {
  return request.post('/shop/goods/list/v2',params)
}
// 获取商品详情信息
const fetChDetail = (params={}) => {
  return request.get('/shop/goods/detail',{params})
}
// 注册
const fetchRef = (params={}) => {
  return request.post('/user/username/register',params)
}
// 登录
const fetchLogin = (params={}) => {
  return request.post('/user/username/login',params)
}
// 加入购物车
const joinCrat = (params={}) => {
  return request.post('/shopping-cart/add',params)
}
// 读取购物车数据
const fetchCart = (params={}) => {
  return request.get('/shopping-cart/info',{params})
}
// 购物车修改购买数量
const updateCartNum = (params = {}) => {
  return request.post('/shopping-cart/modifyNumber',params)
}
// 购物车修改选中状态
const updateStatus = (params = {}) => {
  return request.post('/shopping-cart/select',params)
}
// 移除购物车中某条记录
const removeRecord = (params = {}) => {
  return request.post('/shopping-cart/remove',params)
}
export {
  fetchBanner,
  fetchCate,
  fetchItem,
  fetChDetail,
  fetchRef,
  fetchLogin,
  joinCrat,
  fetchCart,
  updateCartNum,
  updateStatus,
  removeRecord
}